package com.imooc.config;

public class PageConfig {

    /**
     * 总条数
     */
    private int totalNumber;

    /**
     * 当前第几页
     */
    private int currentPage;

    /**
     * 总页数
     */
    private int totalPage;

    /**
     * 每页显示条数
     */
    private int pageSize = 5;

    public int getTotalNumber() {
        return totalNumber;
    }

    public void setTotalNumber(int totalNumber) {
        this.totalNumber = totalNumber;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getTotalPage() {
        int temp = totalNumber / pageSize;
        totalPage = totalNumber % pageSize == 0 ? temp: temp + 1;
        if(totalPage == 0)
            totalPage = 1;
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
}
